<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>oauth2client.service_account</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="oauth2client-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="oauth2client-module.html">Package&nbsp;oauth2client</a> ::
        Module&nbsp;service_account
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="oauth2client.service_account-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="oauth2client.service_account-module.html">Module oauth2client.service_account</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment"># Copyright 2014 Google Inc. All rights reserved.</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"># Licensed under the Apache License, Version 2.0 (the "License");</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"># you may not use this file except in compliance with the License.</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-comment"># You may obtain a copy of the License at</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment">#      http://www.apache.org/licenses/LICENSE-2.0</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-comment"># Unless required by applicable law or agreed to in writing, software</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-comment"># distributed under the License is distributed on an "AS IS" BASIS,</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-comment"># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-comment"># See the License for the specific language governing permissions and</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-comment"># limitations under the License.</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-docstring">"""A service account credentials class.</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring">This credentials class is implemented on top of rsa library.</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">base64</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">json</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">time</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">pyasn1</tt><tt class="py-op">.</tt><tt class="py-name">codec</tt><tt class="py-op">.</tt><tt class="py-name">ber</tt> <tt class="py-keyword">import</tt> <tt class="py-name">decoder</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">pyasn1_modules</tt><tt class="py-op">.</tt><tt class="py-name">rfc5208</tt> <tt class="py-keyword">import</tt> <tt class="py-name">PrivateKeyInfo</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">rsa</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Package oauth2client=oauth2client-module.html"><a title="oauth2client" class="py-name" href="#" onclick="return doclink('link-0', 'oauth2client', 'link-0');">oauth2client</a></tt> <tt class="py-keyword">import</tt> <tt id="link-1" class="py-name" targets="Variable oauth2client.GOOGLE_REVOKE_URI=oauth2client-module.html#GOOGLE_REVOKE_URI"><a title="oauth2client.GOOGLE_REVOKE_URI" class="py-name" href="#" onclick="return doclink('link-1', 'GOOGLE_REVOKE_URI', 'link-1');">GOOGLE_REVOKE_URI</a></tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-2" class="py-name"><a title="oauth2client" class="py-name" href="#" onclick="return doclink('link-2', 'oauth2client', 'link-0');">oauth2client</a></tt> <tt class="py-keyword">import</tt> <tt id="link-3" class="py-name" targets="Variable oauth2client.GOOGLE_TOKEN_URI=oauth2client-module.html#GOOGLE_TOKEN_URI"><a title="oauth2client.GOOGLE_TOKEN_URI" class="py-name" href="#" onclick="return doclink('link-3', 'GOOGLE_TOKEN_URI', 'link-3');">GOOGLE_TOKEN_URI</a></tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-4" class="py-name"><a title="oauth2client" class="py-name" href="#" onclick="return doclink('link-4', 'oauth2client', 'link-0');">oauth2client</a></tt> <tt class="py-keyword">import</tt> <tt id="link-5" class="py-name" targets="Module oauth2client.util=oauth2client.util-module.html"><a title="oauth2client.util" class="py-name" href="#" onclick="return doclink('link-5', 'util', 'link-5');">util</a></tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-6" class="py-name"><a title="oauth2client" class="py-name" href="#" onclick="return doclink('link-6', 'oauth2client', 'link-0');">oauth2client</a></tt><tt class="py-op">.</tt><tt id="link-7" class="py-name" targets="Module oauth2client.client=oauth2client.client-module.html"><a title="oauth2client.client" class="py-name" href="#" onclick="return doclink('link-7', 'client', 'link-7');">client</a></tt> <tt class="py-keyword">import</tt> <tt id="link-8" class="py-name" targets="Class oauth2client.client.AssertionCredentials=oauth2client.client.AssertionCredentials-class.html"><a title="oauth2client.client.AssertionCredentials" class="py-name" href="#" onclick="return doclink('link-8', 'AssertionCredentials', 'link-8');">AssertionCredentials</a></tt> </tt>
<a name="_ServiceAccountCredentials"></a><div id="_ServiceAccountCredentials-def"><a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt> <a class="py-toggle" href="#" id="_ServiceAccountCredentials-toggle" onclick="return toggle('_ServiceAccountCredentials');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="oauth2client.service_account._ServiceAccountCredentials-class.html">_ServiceAccountCredentials</a><tt class="py-op">(</tt><tt class="py-base-class">AssertionCredentials</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_ServiceAccountCredentials-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_ServiceAccountCredentials-expanded"><a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">  <tt class="py-docstring">"""Class representing a service account (signed JWT) credential."""</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">  <tt id="link-9" class="py-name" targets="Variable oauth2client.client.SignedJwtAssertionCredentials.MAX_TOKEN_LIFETIME_SECS=oauth2client.client.SignedJwtAssertionCredentials-class.html#MAX_TOKEN_LIFETIME_SECS,Variable oauth2client.crypt.MAX_TOKEN_LIFETIME_SECS=oauth2client.crypt-module.html#MAX_TOKEN_LIFETIME_SECS,Variable oauth2client.service_account._ServiceAccountCredentials.MAX_TOKEN_LIFETIME_SECS=oauth2client.service_account._ServiceAccountCredentials-class.html#MAX_TOKEN_LIFETIME_SECS"><a title="oauth2client.client.SignedJwtAssertionCredentials.MAX_TOKEN_LIFETIME_SECS
oauth2client.crypt.MAX_TOKEN_LIFETIME_SECS
oauth2client.service_account._ServiceAccountCredentials.MAX_TOKEN_LIFETIME_SECS" class="py-name" href="#" onclick="return doclink('link-9', 'MAX_TOKEN_LIFETIME_SECS', 'link-9');">MAX_TOKEN_LIFETIME_SECS</a></tt> <tt class="py-op">=</tt> <tt class="py-number">3600</tt> <tt class="py-comment"># 1 hour in seconds</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"> </tt>
<a name="_ServiceAccountCredentials.__init__"></a><div id="_ServiceAccountCredentials.__init__-def"><a name="L39"></a><tt class="py-lineno"> 39</tt> <a class="py-toggle" href="#" id="_ServiceAccountCredentials.__init__-toggle" onclick="return toggle('_ServiceAccountCredentials.__init__');">-</a><tt class="py-line">  <tt class="py-keyword">def</tt> <a class="py-def-name" href="oauth2client.service_account._ServiceAccountCredentials-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">service_account_id</tt><tt class="py-op">,</tt> <tt class="py-param">service_account_email</tt><tt class="py-op">,</tt> <tt class="py-param">private_key_id</tt><tt class="py-op">,</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">               <tt class="py-param">private_key_pkcs8_text</tt><tt class="py-op">,</tt> <tt class="py-param">scopes</tt><tt class="py-op">,</tt> <tt class="py-param">user_agent</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line">               <tt class="py-param">token_uri</tt><tt class="py-op">=</tt><tt id="link-10" class="py-name"><a title="oauth2client.GOOGLE_TOKEN_URI" class="py-name" href="#" onclick="return doclink('link-10', 'GOOGLE_TOKEN_URI', 'link-3');">GOOGLE_TOKEN_URI</a></tt><tt class="py-op">,</tt> <tt class="py-param">revoke_uri</tt><tt class="py-op">=</tt><tt id="link-11" class="py-name"><a title="oauth2client.GOOGLE_REVOKE_URI" class="py-name" href="#" onclick="return doclink('link-11', 'GOOGLE_REVOKE_URI', 'link-1');">GOOGLE_REVOKE_URI</a></tt><tt class="py-op">,</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line">               <tt class="py-op">**</tt><tt class="py-param">kwargs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_ServiceAccountCredentials.__init__-collapsed" style="display:none;" pad="+++" indent="++++++"></div><div id="_ServiceAccountCredentials.__init__-expanded"><a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line">    <tt class="py-name">super</tt><tt class="py-op">(</tt><tt id="link-12" class="py-name" targets="Class oauth2client.service_account._ServiceAccountCredentials=oauth2client.service_account._ServiceAccountCredentials-class.html"><a title="oauth2client.service_account._ServiceAccountCredentials" class="py-name" href="#" onclick="return doclink('link-12', '_ServiceAccountCredentials', 'link-12');">_ServiceAccountCredentials</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name" targets="Method oauth2client.appengine.AppAssertionCredentials.__init__()=oauth2client.appengine.AppAssertionCredentials-class.html#__init__,Method oauth2client.appengine.OAuth2Decorator.__init__()=oauth2client.appengine.OAuth2Decorator-class.html#__init__,Method oauth2client.appengine.OAuth2DecoratorFromClientSecrets.__init__()=oauth2client.appengine.OAuth2DecoratorFromClientSecrets-class.html#__init__,Method oauth2client.appengine.StorageByKeyName.__init__()=oauth2client.appengine.StorageByKeyName-class.html#__init__,Method oauth2client.client.AccessTokenCredentials.__init__()=oauth2client.client.AccessTokenCredentials-class.html#__init__,Method oauth2client.client.AssertionCredentials.__init__()=oauth2client.client.AssertionCredentials-class.html#__init__,Method oauth2client.client.GoogleCredentials.__init__()=oauth2client.client.GoogleCredentials-class.html#__init__,Method oauth2client.client.MemoryCache.__init__()=oauth2client.client.MemoryCache-class.html#__init__,Method oauth2client.client.OAuth2Credentials.__init__()=oauth2client.client.OAuth2Credentials-class.html#__init__,Method oauth2client.client.OAuth2WebServerFlow.__init__()=oauth2client.client.OAuth2WebServerFlow-class.html#__init__,Method oauth2client.client.SignedJwtAssertionCredentials.__init__()=oauth2client.client.SignedJwtAssertionCredentials-class.html#__init__,Method oauth2client.django_orm.CredentialsField.__init__()=oauth2client.django_orm.CredentialsField-class.html#__init__,Method oauth2client.django_orm.FlowField.__init__()=oauth2client.django_orm.FlowField-class.html#__init__,Method oauth2client.django_orm.Storage.__init__()=oauth2client.django_orm.Storage-class.html#__init__,Method oauth2client.file.Storage.__init__()=oauth2client.file.Storage-class.html#__init__,Method oauth2client.gce.AppAssertionCredentials.__init__()=oauth2client.gce.AppAssertionCredentials-class.html#__init__,Method oauth2client.keyring_storage.Storage.__init__()=oauth2client.keyring_storage.Storage-class.html#__init__,Method oauth2client.locked_file.LockedFile.__init__()=oauth2client.locked_file.LockedFile-class.html#__init__,Method oauth2client.locked_file._Opener.__init__()=oauth2client.locked_file._Opener-class.html#__init__,Method oauth2client.multistore_file._MultiStore._Storage.__init__()=oauth2client.multistore_file._MultiStore._Storage-class.html#__init__,Method oauth2client.multistore_file._MultiStore.__init__()=oauth2client.multistore_file._MultiStore-class.html#__init__,Method oauth2client.service_account._ServiceAccountCredentials.__init__()=oauth2client.service_account._ServiceAccountCredentials-class.html#__init__"><a title="oauth2client.appengine.AppAssertionCredentials.__init__
oauth2client.appengine.OAuth2Decorator.__init__
oauth2client.appengine.OAuth2DecoratorFromClientSecrets.__init__
oauth2client.appengine.StorageByKeyName.__init__
oauth2client.client.AccessTokenCredentials.__init__
oauth2client.client.AssertionCredentials.__init__
oauth2client.client.GoogleCredentials.__init__
oauth2client.client.MemoryCache.__init__
oauth2client.client.OAuth2Credentials.__init__
oauth2client.client.OAuth2WebServerFlow.__init__
oauth2client.client.SignedJwtAssertionCredentials.__init__
oauth2client.django_orm.CredentialsField.__init__
oauth2client.django_orm.FlowField.__init__
oauth2client.django_orm.Storage.__init__
oauth2client.file.Storage.__init__
oauth2client.gce.AppAssertionCredentials.__init__
oauth2client.keyring_storage.Storage.__init__
oauth2client.locked_file.LockedFile.__init__
oauth2client.locked_file._Opener.__init__
oauth2client.multistore_file._MultiStore._Storage.__init__
oauth2client.multistore_file._MultiStore.__init__
oauth2client.service_account._ServiceAccountCredentials.__init__" class="py-name" href="#" onclick="return doclink('link-13', '__init__', 'link-13');">__init__</a></tt><tt class="py-op">(</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">        <tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-name">user_agent</tt><tt class="py-op">=</tt><tt class="py-name">user_agent</tt><tt class="py-op">,</tt> <tt class="py-name">token_uri</tt><tt class="py-op">=</tt><tt class="py-name">token_uri</tt><tt class="py-op">,</tt> <tt class="py-name">revoke_uri</tt><tt class="py-op">=</tt><tt class="py-name">revoke_uri</tt><tt class="py-op">)</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_service_account_id</tt> <tt class="py-op">=</tt> <tt class="py-name">service_account_id</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_service_account_email</tt> <tt class="py-op">=</tt> <tt id="link-14" class="py-name" targets="Method oauth2client.service_account._ServiceAccountCredentials.service_account_email()=oauth2client.service_account._ServiceAccountCredentials-class.html#service_account_email"><a title="oauth2client.service_account._ServiceAccountCredentials.service_account_email" class="py-name" href="#" onclick="return doclink('link-14', 'service_account_email', 'link-14');">service_account_email</a></tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_private_key_id</tt> <tt class="py-op">=</tt> <tt class="py-name">private_key_id</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_private_key</tt> <tt class="py-op">=</tt> <tt id="link-15" class="py-name" targets="Function oauth2client.service_account._get_private_key()=oauth2client.service_account-module.html#_get_private_key"><a title="oauth2client.service_account._get_private_key" class="py-name" href="#" onclick="return doclink('link-15', '_get_private_key', 'link-15');">_get_private_key</a></tt><tt class="py-op">(</tt><tt class="py-name">private_key_pkcs8_text</tt><tt class="py-op">)</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_private_key_pkcs8_text</tt> <tt class="py-op">=</tt> <tt class="py-name">private_key_pkcs8_text</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line">    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_scopes</tt> <tt class="py-op">=</tt> <tt id="link-16" class="py-name"><a title="oauth2client.util" class="py-name" href="#" onclick="return doclink('link-16', 'util', 'link-5');">util</a></tt><tt class="py-op">.</tt><tt id="link-17" class="py-name" targets="Function oauth2client.util.scopes_to_string()=oauth2client.util-module.html#scopes_to_string"><a title="oauth2client.util.scopes_to_string" class="py-name" href="#" onclick="return doclink('link-17', 'scopes_to_string', 'link-17');">scopes_to_string</a></tt><tt class="py-op">(</tt><tt class="py-name">scopes</tt><tt class="py-op">)</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_user_agent</tt> <tt class="py-op">=</tt> <tt class="py-name">user_agent</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_token_uri</tt> <tt class="py-op">=</tt> <tt class="py-name">token_uri</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line">    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_revoke_uri</tt> <tt class="py-op">=</tt> <tt class="py-name">revoke_uri</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_kwargs</tt> <tt class="py-op">=</tt> <tt class="py-name">kwargs</tt> </tt>
</div><a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line"> </tt>
<a name="_ServiceAccountCredentials._generate_assertion"></a><div id="_ServiceAccountCredentials._generate_assertion-def"><a name="L58"></a><tt class="py-lineno"> 58</tt> <a class="py-toggle" href="#" id="_ServiceAccountCredentials._generate_assertion-toggle" onclick="return toggle('_ServiceAccountCredentials._generate_assertion');">-</a><tt class="py-line">  <tt class="py-keyword">def</tt> <a class="py-def-name" href="oauth2client.service_account._ServiceAccountCredentials-class.html#_generate_assertion">_generate_assertion</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_ServiceAccountCredentials._generate_assertion-collapsed" style="display:none;" pad="+++" indent="++++++"></div><div id="_ServiceAccountCredentials._generate_assertion-expanded"><a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">    <tt class="py-docstring">"""Generate the assertion that will be used in the request."""</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">    <tt class="py-name">header</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line">        <tt class="py-string">'alg'</tt><tt class="py-op">:</tt> <tt class="py-string">'RS256'</tt><tt class="py-op">,</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">        <tt class="py-string">'typ'</tt><tt class="py-op">:</tt> <tt class="py-string">'JWT'</tt><tt class="py-op">,</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">        <tt class="py-string">'kid'</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_private_key_id</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">    <tt class="py-op">}</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line">    <tt class="py-name">now</tt> <tt class="py-op">=</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">time</tt><tt class="py-op">.</tt><tt class="py-name">time</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">    <tt class="py-name">payload</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">        <tt class="py-string">'aud'</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_token_uri</tt><tt class="py-op">,</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">        <tt class="py-string">'scope'</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_scopes</tt><tt class="py-op">,</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line">        <tt class="py-string">'iat'</tt><tt class="py-op">:</tt> <tt class="py-name">now</tt><tt class="py-op">,</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line">        <tt class="py-string">'exp'</tt><tt class="py-op">:</tt> <tt class="py-name">now</tt> <tt class="py-op">+</tt> <tt id="link-18" class="py-name"><a title="oauth2client.service_account._ServiceAccountCredentials" class="py-name" href="#" onclick="return doclink('link-18', '_ServiceAccountCredentials', 'link-12');">_ServiceAccountCredentials</a></tt><tt class="py-op">.</tt><tt id="link-19" class="py-name"><a title="oauth2client.client.SignedJwtAssertionCredentials.MAX_TOKEN_LIFETIME_SECS
oauth2client.crypt.MAX_TOKEN_LIFETIME_SECS
oauth2client.service_account._ServiceAccountCredentials.MAX_TOKEN_LIFETIME_SECS" class="py-name" href="#" onclick="return doclink('link-19', 'MAX_TOKEN_LIFETIME_SECS', 'link-9');">MAX_TOKEN_LIFETIME_SECS</a></tt><tt class="py-op">,</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line">        <tt class="py-string">'iss'</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_service_account_email</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line">    <tt class="py-op">}</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">    <tt class="py-name">payload</tt><tt class="py-op">.</tt><tt class="py-name">update</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_kwargs</tt><tt class="py-op">)</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">    <tt class="py-name">assertion_input</tt> <tt class="py-op">=</tt> <tt class="py-string">'%s.%s'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">        <tt id="link-20" class="py-name" targets="Function oauth2client.crypt._urlsafe_b64encode()=oauth2client.crypt-module.html#_urlsafe_b64encode,Function oauth2client.service_account._urlsafe_b64encode()=oauth2client.service_account-module.html#_urlsafe_b64encode"><a title="oauth2client.crypt._urlsafe_b64encode
oauth2client.service_account._urlsafe_b64encode" class="py-name" href="#" onclick="return doclink('link-20', '_urlsafe_b64encode', 'link-20');">_urlsafe_b64encode</a></tt><tt class="py-op">(</tt><tt class="py-name">header</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">        <tt id="link-21" class="py-name"><a title="oauth2client.crypt._urlsafe_b64encode
oauth2client.service_account._urlsafe_b64encode" class="py-name" href="#" onclick="return doclink('link-21', '_urlsafe_b64encode', 'link-20');">_urlsafe_b64encode</a></tt><tt class="py-op">(</tt><tt class="py-name">payload</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line">    <tt class="py-name">assertion_input</tt> <tt class="py-op">=</tt> <tt class="py-name">assertion_input</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'utf-8'</tt><tt class="py-op">)</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line"> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">    <tt class="py-comment"># Sign the assertion.</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">    <tt class="py-name">signature</tt> <tt class="py-op">=</tt> <tt class="py-name">bytes</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt><tt class="py-name">base64</tt><tt class="py-op">.</tt><tt class="py-name">urlsafe_b64encode</tt><tt class="py-op">(</tt><tt class="py-name">rsa</tt><tt class="py-op">.</tt><tt class="py-name">pkcs1</tt><tt class="py-op">.</tt><tt class="py-name">sign</tt><tt class="py-op">(</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">        <tt class="py-name">assertion_input</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_private_key</tt><tt class="py-op">,</tt> <tt class="py-string">'SHA-256'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">rstrip</tt><tt class="py-op">(</tt><tt class="py-string">'='</tt><tt class="py-op">)</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line"> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-string">'%s.%s'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">assertion_input</tt><tt class="py-op">,</tt> <tt class="py-name">signature</tt><tt class="py-op">)</tt> </tt>
</div><a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line"> </tt>
<a name="_ServiceAccountCredentials.sign_blob"></a><div id="_ServiceAccountCredentials.sign_blob-def"><a name="L88"></a><tt class="py-lineno"> 88</tt> <a class="py-toggle" href="#" id="_ServiceAccountCredentials.sign_blob-toggle" onclick="return toggle('_ServiceAccountCredentials.sign_blob');">-</a><tt class="py-line">  <tt class="py-keyword">def</tt> <a class="py-def-name" href="oauth2client.service_account._ServiceAccountCredentials-class.html#sign_blob">sign_blob</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">blob</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_ServiceAccountCredentials.sign_blob-collapsed" style="display:none;" pad="+++" indent="++++++"></div><div id="_ServiceAccountCredentials.sign_blob-expanded"><a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">    <tt class="py-comment"># Ensure that it is bytes</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">      <tt class="py-name">blob</tt> <tt class="py-op">=</tt> <tt class="py-name">blob</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'utf-8'</tt><tt class="py-op">)</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt> <tt class="py-name">AttributeError</tt><tt class="py-op">:</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">      <tt class="py-keyword">pass</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_private_key_id</tt><tt class="py-op">,</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">            <tt class="py-name">rsa</tt><tt class="py-op">.</tt><tt class="py-name">pkcs1</tt><tt class="py-op">.</tt><tt class="py-name">sign</tt><tt class="py-op">(</tt><tt class="py-name">blob</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_private_key</tt><tt class="py-op">,</tt> <tt class="py-string">'SHA-256'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line"> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">  <tt class="py-decorator">@</tt><tt class="py-decorator">property</tt> </tt>
<a name="_ServiceAccountCredentials.service_account_email"></a><div id="_ServiceAccountCredentials.service_account_email-def"><a name="L98"></a><tt class="py-lineno"> 98</tt> <a class="py-toggle" href="#" id="_ServiceAccountCredentials.service_account_email-toggle" onclick="return toggle('_ServiceAccountCredentials.service_account_email');">-</a><tt class="py-line">  <tt class="py-keyword">def</tt> <a class="py-def-name" href="oauth2client.service_account._ServiceAccountCredentials-class.html#service_account_email">service_account_email</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_ServiceAccountCredentials.service_account_email-collapsed" style="display:none;" pad="+++" indent="++++++"></div><div id="_ServiceAccountCredentials.service_account_email-expanded"><a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_service_account_email</tt> </tt>
</div><a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line"> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">  <tt class="py-decorator">@</tt><tt class="py-decorator">property</tt> </tt>
<a name="_ServiceAccountCredentials.serialization_data"></a><div id="_ServiceAccountCredentials.serialization_data-def"><a name="L102"></a><tt class="py-lineno">102</tt> <a class="py-toggle" href="#" id="_ServiceAccountCredentials.serialization_data-toggle" onclick="return toggle('_ServiceAccountCredentials.serialization_data');">-</a><tt class="py-line">  <tt class="py-keyword">def</tt> <a class="py-def-name" href="oauth2client.service_account._ServiceAccountCredentials-class.html#serialization_data">serialization_data</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_ServiceAccountCredentials.serialization_data-collapsed" style="display:none;" pad="+++" indent="++++++"></div><div id="_ServiceAccountCredentials.serialization_data-expanded"><a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-op">{</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">        <tt class="py-string">'type'</tt><tt class="py-op">:</tt> <tt class="py-string">'service_account'</tt><tt class="py-op">,</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">        <tt class="py-string">'client_id'</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_service_account_id</tt><tt class="py-op">,</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">        <tt class="py-string">'client_email'</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_service_account_email</tt><tt class="py-op">,</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">        <tt class="py-string">'private_key_id'</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_private_key_id</tt><tt class="py-op">,</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">        <tt class="py-string">'private_key'</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_private_key_pkcs8_text</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">    <tt class="py-op">}</tt> </tt>
</div><a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line"> </tt>
<a name="_ServiceAccountCredentials.create_scoped_required"></a><div id="_ServiceAccountCredentials.create_scoped_required-def"><a name="L111"></a><tt class="py-lineno">111</tt> <a class="py-toggle" href="#" id="_ServiceAccountCredentials.create_scoped_required-toggle" onclick="return toggle('_ServiceAccountCredentials.create_scoped_required');">-</a><tt class="py-line">  <tt class="py-keyword">def</tt> <a class="py-def-name" href="oauth2client.service_account._ServiceAccountCredentials-class.html#create_scoped_required">create_scoped_required</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_ServiceAccountCredentials.create_scoped_required-collapsed" style="display:none;" pad="+++" indent="++++++"></div><div id="_ServiceAccountCredentials.create_scoped_required-expanded"><a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_scopes</tt> </tt>
</div><a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line"> </tt>
<a name="_ServiceAccountCredentials.create_scoped"></a><div id="_ServiceAccountCredentials.create_scoped-def"><a name="L114"></a><tt class="py-lineno">114</tt> <a class="py-toggle" href="#" id="_ServiceAccountCredentials.create_scoped-toggle" onclick="return toggle('_ServiceAccountCredentials.create_scoped');">-</a><tt class="py-line">  <tt class="py-keyword">def</tt> <a class="py-def-name" href="oauth2client.service_account._ServiceAccountCredentials-class.html#create_scoped">create_scoped</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">scopes</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_ServiceAccountCredentials.create_scoped-collapsed" style="display:none;" pad="+++" indent="++++++"></div><div id="_ServiceAccountCredentials.create_scoped-expanded"><a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt id="link-22" class="py-name"><a title="oauth2client.service_account._ServiceAccountCredentials" class="py-name" href="#" onclick="return doclink('link-22', '_ServiceAccountCredentials', 'link-12');">_ServiceAccountCredentials</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_service_account_id</tt><tt class="py-op">,</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">                                      <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_service_account_email</tt><tt class="py-op">,</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">                                      <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_private_key_id</tt><tt class="py-op">,</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">                                      <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_private_key_pkcs8_text</tt><tt class="py-op">,</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">                                      <tt class="py-name">scopes</tt><tt class="py-op">,</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">                                      <tt class="py-name">user_agent</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_user_agent</tt><tt class="py-op">,</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">                                      <tt class="py-name">token_uri</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_token_uri</tt><tt class="py-op">,</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">                                      <tt class="py-name">revoke_uri</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_revoke_uri</tt><tt class="py-op">,</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">                                      <tt class="py-op">**</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_kwargs</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line"> </tt>
<a name="_urlsafe_b64encode"></a><div id="_urlsafe_b64encode-def"><a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line"> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt> <a class="py-toggle" href="#" id="_urlsafe_b64encode-toggle" onclick="return toggle('_urlsafe_b64encode');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="oauth2client.service_account-module.html#_urlsafe_b64encode">_urlsafe_b64encode</a><tt class="py-op">(</tt><tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_urlsafe_b64encode-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_urlsafe_b64encode-expanded"><a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">  <tt class="py-keyword">return</tt> <tt class="py-name">base64</tt><tt class="py-op">.</tt><tt class="py-name">urlsafe_b64encode</tt><tt class="py-op">(</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">      <tt class="py-name">json</tt><tt class="py-op">.</tt><tt class="py-name">dumps</tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">,</tt> <tt class="py-name">separators</tt><tt class="py-op">=</tt><tt class="py-op">(</tt><tt class="py-string">','</tt><tt class="py-op">,</tt> <tt class="py-string">':'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'UTF-8'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">rstrip</tt><tt class="py-op">(</tt><tt class="py-string">b'='</tt><tt class="py-op">)</tt> </tt>
</div><a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line"> </tt>
<a name="_get_private_key"></a><div id="_get_private_key-def"><a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line"> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt> <a class="py-toggle" href="#" id="_get_private_key-toggle" onclick="return toggle('_get_private_key');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="oauth2client.service_account-module.html#_get_private_key">_get_private_key</a><tt class="py-op">(</tt><tt class="py-param">private_key_pkcs8_text</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_get_private_key-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_get_private_key-expanded"><a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">  <tt class="py-docstring">"""Get an RSA private key object from a pkcs8 representation."""</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line"> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">  <tt class="py-name">der</tt> <tt class="py-op">=</tt> <tt class="py-name">rsa</tt><tt class="py-op">.</tt><tt class="py-name">pem</tt><tt class="py-op">.</tt><tt class="py-name">load_pem</tt><tt class="py-op">(</tt><tt class="py-name">private_key_pkcs8_text</tt><tt class="py-op">,</tt> <tt class="py-string">'PRIVATE KEY'</tt><tt class="py-op">)</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line">  <tt class="py-name">asn1_private_key</tt><tt class="py-op">,</tt> <tt class="py-name">_</tt> <tt class="py-op">=</tt> <tt class="py-name">decoder</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt><tt class="py-name">der</tt><tt class="py-op">,</tt> <tt class="py-name">asn1Spec</tt><tt class="py-op">=</tt><tt class="py-name">PrivateKeyInfo</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line">  <tt class="py-keyword">return</tt> <tt class="py-name">rsa</tt><tt class="py-op">.</tt><tt class="py-name">PrivateKey</tt><tt class="py-op">.</tt><tt class="py-name">load_pkcs1</tt><tt class="py-op">(</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">      <tt class="py-name">asn1_private_key</tt><tt class="py-op">.</tt><tt class="py-name">getComponentByName</tt><tt class="py-op">(</tt><tt class="py-string">'privateKey'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">asOctets</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line">      <tt class="py-name">format</tt><tt class="py-op">=</tt><tt class="py-string">'DER'</tt><tt class="py-op">)</tt> </tt>
</div><a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="oauth2client-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Thu Nov 13 12:43:44 2014
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
